using System;
using System.Windows.Forms;
using CSettingsUI;


namespace CSettingsUI
{
   
	/// <summary>
	/// IPropertyConverterControl implementation for TextBox.
	/// </summary>
	public class TextBoxOption : TextBox, IPropertyConverterControl
	{
		public TextBoxOption()
		{

			
		}
	
		#region IPropertyConverterControl Members

		public object Value
		{
			get
			{
				// TODO:  Add TextBoxOption.Value getter implementation
				return base.Text;
			}
			set
			{
                if (value is string)
                {
                    base.Text = (string)value;
                }
                else
                    base.Text = value.ToString();

			}
		}

		#endregion
	}
    public class TextBoxClassOption: TextBox, IPropertyConverterControl
    {
        private object val;
        public TextBoxClassOption()
        {


        }
        protected override void OnClick(EventArgs e)
        {
            if (val != null)
            {
                CSettingsUI.SettingForm sf = new CSettingsUI.SettingForm();
                sf.SelectedObject = this.val;
                sf.ShowDialog(this);
                this.val = sf.SelectedObject;
                base.Text = val.ToString();
              
                //this.OnValidating(new System.ComponentModel.CancelEventArgs());
                //this.OnValidated(new EventArgs());

            }
            else
            {

            }
            //SaveSettings();

        }
        #region IPropertyConverterControl Members

        public object Value
        {
            get
            {
                // TODO:  Add TextBoxOption.Value getter implementation
                return base.Text;
            }
            set
            {
                if (value is string)
                {
                    base.Text = (string)value;
                }
                else
                    base.Text = value.ToString();

            }
        }

        #endregion
    }

}
